package com.galaxy.coupon.api;

import com.galaxy.common.core.domain.R;
import com.galaxy.common.core.validate.AddGroup;
import com.galaxy.common.core.validate.EditGroup;
import com.galaxy.common.log.annotation.Log;
import com.galaxy.common.log.enums.BusinessType;
import com.galaxy.common.mybatis.core.page.PageQuery;
import com.galaxy.common.mybatis.core.page.TableDataInfo;
import com.galaxy.common.web.core.BaseController;
import com.galaxy.coupon.domain.bo.PointsExchangeRuleBo;
import com.galaxy.coupon.domain.vo.PointsExchangeRuleVo;
import com.galaxy.coupon.service.IPointsExchangeRuleService;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 积分兑换规则Controller
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/exchange")
public class PointsExchangeRuleApiController extends BaseController {

    private final IPointsExchangeRuleService pointsExchangeRuleService;

    /**
     * 查询积分兑换规则列表
     */
    @GetMapping("/list")
    public TableDataInfo<PointsExchangeRuleVo> list() {
        return pointsExchangeRuleService.selectAllPointsExchangeRulesWithCoupons();
    }

    /**
     * 获取积分兑换规则详细信息
     */
    @GetMapping("/{id}")
    public R<PointsExchangeRuleVo> getInfo(@NotNull(message = "主键不能为空") @PathVariable Long id) {
        return R.ok(pointsExchangeRuleService.selectPointsExchangeRuleWithCouponById(id));
    }



}
